# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Contributor: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>

pkgname=vim-ultisnips
pkgver=3.2
pkgrel=8
pkgdesc='TextMate-style snippets for Vim.'
arch=('any')
url='https://github.com/SirVer/ultisnips'
license=('GPL3')
depends=('vim-plugin-runtime' 'python')
groups=('vim-plugins')
replaces=('vim-snipmate')
makedepends=('git')
_commit=2a4beefc7dfff8419f40f2672cfaaa726bdbff72
source=("${pkgname}-${pkgver}.tar.gz"::"https://github.com/SirVer/ultisnips/archive/${pkgver}.tar.gz"
        git+https://github.com/honza/vim-snippets.git#commit=$_commit)
sha256sums=('550365cdf6bf030b9e5b77e511b4e6b1427660ea6a117c4b6bb77afcb950c4ce'
            'SKIP')

package() {
  cd "ultisnips-$pkgver"

  install -dm755 "$pkgdir/usr/share/vim/vimfiles/"
  cp -r -t "$pkgdir/usr/share/vim/vimfiles/" pythonx after doc ftdetect autoload\
      ftplugin plugin syntax

  cd "${srcdir}/vim-snippets"

  install -dm755 "$pkgdir/usr/share/vim/vimfiles/"
  cp -r -t "$pkgdir/usr/share/vim/vimfiles/" UltiSnips autoload snippets pythonx

  # compile .pyc and .pyo files (fixes FS#43121)
  find "${pkgdir}" -name '*.py' -exec python -mpy_compile {} +
  find "${pkgdir}" -name '*.py' -exec python -O -mpy_compile {} +
}
